﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MaxLeaf.Platform.Contract;
using MaxLeaf.Platform.BLLImplementation;
using CommonsLib.Utility;
using MaxLeaf.Platform.DataContract;
using CommonsLib.Settings;
using MaxLeaf.Platform.Functions;

namespace MaxLeaf.Platform.BLLProxy
{

    /// <summary>
    /// 领用出库 相关操作
    /// </summary>
    public class imStoresOutputProcessorProxy : BaseBLLProxy, IStoresOutputProcess
    {

        IStoresOutputProcess _bll;
        private  IStoresOutputProcess BLL
        {
            get
            {                
                return _bll;
            }
        }
        public imStoresOutputProcessorProxy():base()
        {
            switch ( Access_Mode )
            {

                case MaxLeaf.Platform.Commons.Const.ACCESS_Direct:
                    {
                        _bll = new imStoresOutputProcessor();
                        break;
                    }

                case MaxLeaf.Platform.Commons.Const.ACCESS_IIS:
                    {
                        _bll = new imStoresOutputProcessorWCFClient(this.WCF_Configs);
                        break;
                    }


                default:
                    {
                        throw new MaxLeaf.Platform.Commons.MaxLeafException(MaxLeaf.Platform.Commons.Const.EXCEPTION_MESSAGE_INVALID_ACCESSMODE_CONFIG);

                    }
            }
        }
       

        /// <summary>
        /// 生成出库
        /// </summary>
        /// <param name="intEnterUserId">  制单人id</param>
        /// <param name="intHdrID">  hdr key</param>
        /// <param name="lstDtlKeys"> dtl 集合 -- 如果为空,表示整张单</param>
        /// <returns>出库</returns>
        public imOthersOutputHdrDataModel Post(int intEnterUserId, int intHdrID, List<int> lstDtlKeys,string strRemark)
        {
            return BLL.Post(   intEnterUserId, intHdrID, lstDtlKeys,  strRemark);
        }


        /// <summary>
        /// 退回到领用出库
        /// </summary>
        /// <param name="intOthersOutputHdrID">出库单id</param>
        /// <returns></returns>
        public bool UnPost(int intOthersOutputHdrID)
        {
            return BLL.UnPost(intOthersOutputHdrID);
        }
    }
}
